package h0731;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author 不知名帅哥
 * @version 1.0
 * @description 找座位
 * @date 2024/7/31 21:07
 */
public class FindSeats {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        sc.close();
        s = "0" + s + "0"; //处理边界情况
        Pattern p = Pattern.compile("0+");
        Matcher matcher = p.matcher(s);
        List<String> list = new ArrayList<>();
        while (matcher.find()) {
            list.add(matcher.group());
        }
        int count = 0;
        for (String string : list) {
            int n = string.length();
            if (n >= 3) {
                //3 1 5 2 7 3
                int temp = (n - 1) / 2;
                count += temp;
            }
        }
        System.out.println(count);
//        System.out.println(list);
    }
}
